package lib.self.utils;

import android.app.ActionBar.LayoutParams;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup.MarginLayoutParams;

import java.util.HashSet;
import java.util.Set;

import lib.self.bean.Screen;

/**
 * description: 自动获取xml里的参数（px）,根据分辨率的scale来重新设置大小
 * author: Steven Xiao
 * date: 2017/3/31
 */
public class AutoFitUtil {
    public static final int KMaxScreenWidth = 1080;
    public static final int KMaxScreenHeight = 1920;

    public static final int MATCH_PARENT = LayoutParams.MATCH_PARENT;
    public static final int WRAP_CONTENT = LayoutParams.WRAP_CONTENT;

    public static Set<View> mSetFit = new HashSet<>();

    public static float getScale(Context context) {
        Screen screen = new Screen(context);
        return screen.mWidth / (float) KMaxScreenWidth;
    }

    private static void setMarginParams(View view, MarginLayoutParams params) {

    }

    private static int getTransformWH(int value) {
        if (value == 0 || value == MATCH_PARENT || value == WRAP_CONTENT || value == 1) {
            return value;
        }
        return 0;
    }

}
